import request from '@/utils/axios'

export type ErrorCodeType = {
  id: number | undefined
  applicationName: string
  code: string
  message: string
  remark: string
  create_time?: Date
}

export interface ErrorCodePageReqType extends PageParam {
  applicationName?: string
  code?: string
  message?: string
  create_time?: Date[]
}

/**
 * 错误码接口
 */
export const ErrorCodeApi = {
  // 新增
  create: (data: ErrorCodeType) => {
    return request.post({ url: '/system/error-code/create', data, is_mock: true })
  },
  // 修改
  update: (data: ErrorCodeType) => {
    return request.put({ url: '/system/error-code/update', data, is_mock: true })
  },
  // 删除
  delete: (id: number | string) => {
    return request.delete({ url: '/system/error-code/delete?id=' + id, is_mock: true })
  },
  // 查询详情
  detail: (id: number | string) => {
    return request.get({ url: '/system/error-code/detail?id=' + id, is_mock: true })
  },
  // 查询分页列表
  page: (params: ErrorCodePageReqType) => {
    return request.get({ url: '/system/error-code/page', params, is_mock: true })
  },
  // 导出
  export: (params: ErrorCodePageReqType) => {
    return request.get({ url: '/system/error-code/export', params, is_mock: true })
  }
}
